Git VCS
Links Resources
Git Install
curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz
Git commands
Initialize a local Git repository
clone public repository
git clone [repository-url]
Clone private repository
git clone ssh://git@github.com/[username]/[repository-name].git
Check status
Add a file to the staging area
Add all new and changed files to the staging area
Commit changes
git commit -m "[commit message]"
Remove a file (or folder)
git rm -r [file-name.txt]
Show current branch
List of branches
Create a new branch
Delete a branch
git branch -d [branch name]
Delete a branch forcefully
git branch -D [branch name]
Delete a remote branch
git push origin --delete [branch name]
Create a new branch and switch to it
git checkout -b [branch name]
Clone a remote branch and switch to it
git checkout -b [branch name] origin/[branch name]
Rename a local branch
git branch -m [old branch name] [new branch name]
Discard changes to a file
git checkout -- [file_name.txt]
Merge a branch into the active branch
Merge a branch into a target branch
git merge [source branch] [target branch]
Stash changes in a dirty working directory
Remove all stashed entries
Push a branch to your remote repository
git push origin [branch name]
Push changes to new branch at remote repository
git push -u origin [branch name]
Push changes to remote repository
Delete a remote branch
git push origin --delete [branch name]
Update local repository to the newest commit
Pull changes from remote repository
git pull origin [branch name]
Add a remote repository
git remote add origin ssh://git@github.com/[username]/[repository-name].git
Set a repository's origin branch to SSH
git remote set-url origin ssh://git@github.com/[username]/[repository-name].git
View changes
View detailed changes
View changes, briefly
Preview changes before merging
git diff [source branch] [target branch]
Revert commit changes
Set globally Username
git config --global user.name "your_username"
Set globally Email id
git config --global user.email "your_email_address@example.com"
Get global config
git config --global --list
GitHUb CLI
sudo dnf install gh
gh auth login
gh repo clone <repository>
Gitea
//compose.yml
version: '2'
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
volumes:
- /data/gitea:/data
ports:
- "3000:3000"
- "222:22"
restart: always
docker-compose --file compose.yaml up -d
Or
podman compose --file compose.yaml up --detach
Jujutsu
cargo binstall --strategies crate-meta-data jj-cli
source <(jj util completion bash)
source <(COMPLETE=bash jj)
jj git clone [repository-url]